﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;


    class Program
    {
        static void Main(string[] args)
        {
            StreamReader firsFile = new StreamReader("firstFile.txt");
            StreamReader secondFile = new StreamReader("secondFile.txt");
            using (firsFile)
            {
                StreamWriter writer = new StreamWriter("newFile.txt",false, Encoding.GetEncoding("UTF-8"));
                using(writer)
                {
                string line=firsFile.ReadLine();
                while (line != null)
                {
                    writer.WriteLine(line);
                    Console.WriteLine(line);
                    line = firsFile.ReadLine();
                }
                }
            }
            using (secondFile)
            {
                StreamWriter writer = new StreamWriter("newFile.txt", true, Encoding.GetEncoding("UTF-8"));
                using (writer)
                {
                    string line = secondFile.ReadLine();
                    while (line != null)
                    {
                        writer.WriteLine(line);
                        Console.WriteLine(line);
                        line = secondFile.ReadLine();
                    }
                }
            }
          
        }
    }

